package DataBase;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Reset {
	private int ds_ID;
	private String ds_hostname;
	private String ds_IP;
	private int fu_ID;
	private String asmt_ftpname;

	private String asmt_ftppwd;
	private String asmt_name;
	private String asmt_path;
	private String asmt_next;
	private String asmt_time;
	private String asmt_frequency;
	private String asmt_state;

	public String getAsmt_ftpname() {
		return asmt_ftpname;
	}

	public void setAsmt_ftpname(String asmtFtpname) {
		asmt_ftpname = asmtFtpname;
	}

	public String getAsmt_ftppwd() {
		return asmt_ftppwd;
	}

	public void setAsmt_ftppwd(String asmtFtppwd) {
		asmt_ftppwd = asmtFtppwd;
	}

	public int getFu_ID() {
		return fu_ID;
	}

	public void setFu_ID(int fuID) {
		fu_ID = fuID;
	}

	public void setAsmt_name(String asmtName) {
		asmt_name = asmtName;
	}

	public void setAsmt_state(String asmtState) {
		asmt_state = asmtState;
	}

	public void setDs_ID(int ds_ID) {
		this.ds_ID = ds_ID;
	}

	public int getDs_ID() {
		return ds_ID;
	}

	public String getDs_hostname() {
		return ds_hostname;
	}

	public void setDs_hostname(String dsHostname) {
		ds_hostname = dsHostname;
	}

	public String getDs_IP() {
		return ds_IP;
	}

	public void setDs_IP(String dsIP) {
		ds_IP = dsIP;
	}

	public String getAsmt_path() {
		return asmt_path;
	}

	public void setAsmt_path(String asmtPath) {
		asmt_path = asmtPath;
	}

	public String getAsmt_next() {
		return asmt_next;
	}

	public void setAsmt_next(String asmtNext) {
		asmt_next = asmtNext;
	}

	public String getAsmt_time() {
		return asmt_time;
	}

	public void setAsmt_time(String asmtTime) {
		asmt_time = asmtTime;
	}

	public String getAsmt_frequency() {
		return asmt_frequency;
	}

	public void setAsmt_frequency(String asmtFrequency) {
		asmt_frequency = asmtFrequency;
	}

	public void setAsmt_names(String asmt_name) {
		this.asmt_name = asmt_name;
	}

	public String getAsmt_name() {
		return asmt_name;
	}

	public void setAsmt_states(String asmt_state) {
		this.asmt_state = asmt_state;
	}

	public String getAsmt_state() {
		return asmt_state;
	}

	public String getFormatFrequency() {
		String FormatFrequency = null;
		try {
			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
			Date oldnextdate;
			oldnextdate = df.parse(this.asmt_next);
			Calendar oldnextcal = Calendar.getInstance();
			oldnextcal.setTime(oldnextdate);
			if (this.fu_ID == 1) {
				FormatFrequency = this.asmt_frequency + "天";
			} else if (this.fu_ID == 2) {
				int daycount = oldnextcal.get(Calendar.DAY_OF_WEEK);
				FormatFrequency = this.asmt_frequency + "周："
						+ Assignment.IntToWeek(daycount);
			} else if (this.fu_ID == 3) {
				int dayofmonth = oldnextcal.get(Calendar.DAY_OF_MONTH);
				FormatFrequency = this.asmt_frequency + "月：" + dayofmonth + "号";
			}

		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return FormatFrequency;
	}

	public String getFrequencyDetail() {
		String FormatFrequency = "";
		try {
			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
			Date oldnextdate;
			oldnextdate = df.parse(this.asmt_next);
			Calendar oldnextcal = Calendar.getInstance();
			oldnextcal.setTime(oldnextdate);
			if (this.fu_ID == 1) {
				FormatFrequency = "";
			} else if (this.fu_ID == 2) {
				int daycount = oldnextcal.get(Calendar.DAY_OF_WEEK);
				FormatFrequency = Assignment.IntToWeek(daycount);
			} else if (this.fu_ID == 3) {
				int dayofmonth = oldnextcal.get(Calendar.DAY_OF_MONTH);
				FormatFrequency = dayofmonth + "";
			}

		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return FormatFrequency;
	}

}
